home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / Libraries / UMacAppUtilities.a < prev    next >
Encoding:
Text File  |  1991-05-01  |  2.7 KB  |  97 lines  |  [TEXT/MPS ]

  1. ;=============================================================================
  2. ; UMacAppUtilities assembly language routines
  3. ;
  4. ; KNOWN LIMITATIONS
  5. ;
  6. ; Copyright © 1987-1990 Apple Computer, Inc.  All rights reserved.
  7. ;
  8. ; when       who    what
  9. ; -------- ---- --------------------------------------------------------------
  10. ; 88.07.28 srf    add header and includes for Macros
  11. ; ----------------------------------------------------------------------------
  12.  
  13.                 Blanks        On
  14.                 String        AsIs
  15.                 Case        On
  16.  
  17.                 Print        Off
  18.                 Include     'Macros.a'
  19.  
  20.                 LOAD            'ProgStrucMacs.d'
  21.                 LOAD            'FlowCtlMacs.d'
  22.                 Print        On
  23.  
  24.  
  25. ;---------------------------------------------------------------------------------------------------
  26. ;    FUNCTION  EqualBlocks(first, second: UNIV Ptr; theSize: INTEGER): BOOLEAN;
  27. ;    Returns true if blocks pointed to by 'first' and 'second' are equal over
  28. ;    'theSize' number of bytes.
  29. ;    Trashes:    D0,D1,A0,A1
  30.  
  31.                 Seg         'MAUtilitiesRes'
  32. EXPORT FUNCTION EQUALBLOCKS(first:L, second:L, theSize):B
  33.     VAR            addrStore:L
  34.  
  35.     BEGIN
  36.                 
  37.                 Move.B        #1,EQUALBLOCKS(FP)        ; Prime result to TRUE
  38.                 
  39.                 Move.L        first(FP),A0        ; Point at data blocks
  40.                 Move.L        second(FP),A1
  41.                 Move        theSize(FP),D0        ; Fetch count
  42.  
  43. * handle odd-addressing
  44.                 Tst            D0                    ; Anything to compare?
  45.                 Beq.S        @4                    ; Nope, we're done
  46.                 Move.L        A0,addrStore(FP)
  47.                 Move.L        addrStore(FP),D1    ; Work with address
  48.                 And            #1,D1                ; Is it odd?
  49.                 Beq.S        @0                    ; If it ain't, go on to normal stuff
  50.                 CmpM.B        (A0)+,(A1)+            ; Check the odd address
  51.                 Bne.S        @3                    ; Not equal, so punt
  52.                 SubQ        #1,D0                ; One less value to check
  53.  
  54. * even-addressing
  55.         @0:        Move        D0,D1                ; Sub-long count
  56.                 And         #3,D1
  57.                 LsR         #2,D0                ; Long count
  58.                 Beq.S        @1                    ; No longs, so try sub-longs
  59.                 SubQ        #1,D0                ; Back off one for DBeq
  60.                 
  61.         @2:     CmpM.L        (A0)+,(A1)+         ; Compare values
  62.                 DBne        D0,@2
  63.                 Bne.S        @3                    ; Not equal, so punt
  64.                 
  65.         @1:     Tst         D1                    ; Any sub-longs?
  66.                 Beq.S        @4                    ; Nope, we're done
  67.                 SubQ        #1,D1                ; Back off one for DBeq
  68.                 
  69.         @5:     CmpM.B        (A0)+,(A1)+         ; Compare values
  70.                 DBne        D1,@5
  71.                 
  72.                 Beq.S        @4                    ; Equal, so we're done
  73.                 
  74.         @3:     Clr.B        EQUALBLOCKS(FP)     ; Signal false
  75.         
  76.         @4:     Return
  77.                 ENDF
  78.  
  79. ;---------------------------------------------------------------------------------------------------
  80. ; FUNCTION StripLong(address: UNIV Ptr): LONGINT;
  81. ; Masks address with a pre-stripped address to avoid icky StripAddress glue !
  82. ; Can't use "C" attribute for function since Think™ Pascal can't take the heat (TP 3.0)
  83. ;    Trashes:    D0
  84.  
  85.                 Seg         'MAUtilitiesRes'
  86. EXPORT FUNCTION STRIPLONG(address:L):L
  87.  
  88.     BEGIN
  89.     IMPORT        gStrippedAddress:Data
  90.                 MOVE.L        gStrippedAddress(A5),D0
  91.                 AND.L        address(FP),D0
  92.                 MOVE.L        D0, STRIPLONG(FP) 
  93.                 Return
  94.                 ENDP
  95.  
  96.                 END
  97.